Discover Open Ports In Windows
We can do this using netstat (network statistics) command in powershell or cmd.
It is used to display:
- open ports
- protocol statistics
- routing table
- network interfaces
- Open cmd (command prompt) and type:
netstat /?
To get help about the command

-
netstat -ano

-
-a Displays all connections and listening ports.
-
-n Displays addresses and port numbers in numerical form.
-
-o Displays process ID associated with each connection.
- Use -b to display the .exe file associated with each connection.

- To use -b run cmd as administrator.
Tracing The Services Or Processes associated with the ports
- Open Task Manger and go to services tab
- Sort it by PID (Process ID)
- Select the required PID (like 4424)

- Right Click>Go to details
- In Details tab, Right Click>properties

- This will open up properties of the executable (.exe) associated with the service.

- Here we can see mqsvc.exe (Message Queuing Service) with PID 4424 using the ports 1801,2103/5/7.